跳到主要内容

Debug Cloud Connection Issues (Device Side)

This guide covers common cloud connection issues observed in the device firmware log, along with steps to diagnose and resolve them.

DNS Resolution Timeout

Symptom

The device log repeatedly shows a DNS resolution timeout when connecting to the cloud:

esp-tls: couldn't get hostname for :a1p72mufdu6064-ats.iot.us-east-1.amazonaws.com: getaddrinfo() returns 202, addrinfo=0

What it means

The device failed to resolve the cloud endpoint hostname via DNS. The router's DNS or internet connectivity is likely the root cause.

Steps to debug

  1. Connect a PC to the same router and ping the cloud hostname to confirm whether DNS resolution works from the router's network.
  2. Restart the router or the device.
  3. If possible, capture over-the-air packets to verify the device is sending DNS queries and that the router is responding correctly. See the Espressif Wireshark User Guide.

MQTT Connection Fails After SSL Handshake Succeeds

Symptom

I (20580) esp-x509-crt-bundle: Certificate validated
E (21730) mqtt_client: esp_mqtt_handle_transport_read_error: transport_read(): EOF
E (21730) mqtt_client: esp_mqtt_handle_transport_read_error: transport_read() error: errno=119
E (21740) esp_mqtt_glue: MQTT_EVENT_ERROR
E (21740) mqtt_client: esp_mqtt_connect: mqtt_message_receive() returned -2
E (21750) mqtt_client: MQTT connect failed

What it means

The device completed the SSL handshake with the MQTT broker, but the broker closed the connection during MQTT session setup.

Steps to debug

  1. Verify that the MQTT broker endpoint the device is connecting to (visible in the log) matches the server where the node was registered. A mismatch causes the broker to reject the connection.
  2. Confirm the device node ID is correct — it is used as the MQTT client ID in the connect packet.
  3. Erase the entire device flash, reflash firmware and certificates, and re-provision.
  4. Check whether the device's network has a proxy enabled. If so, try disabling the proxy.

MQTT Session Drops Immediately After Connecting

Symptom

I (20154) esp-x509-crt-bundle: Certificate validated
I (21384) esp_mqtt_glue: MQTT Connected
E (21994) mqtt_client: esp_mqtt_handle_transport_read_error: transport_read(): EOF
E (21994) mqtt_client: esp_mqtt_handle_transport_read_error: transport_read() error: errno=119
E (22004) esp_mqtt_glue: MQTT_EVENT_ERROR
E (22014) mqtt_client: mqtt_process_receive: mqtt_message_receive() returned -2
W (22024) esp_mqtt_glue: MQTT Disconnected. Will try reconnecting in a while...

What it means

Both the SSL handshake and MQTT session establishment succeeded, but the broker terminated the connection immediately afterward.

Steps to debug

  1. Check whether the firmware registers any custom MQTT topics. The RainMaker platform validates MQTT topic subscriptions server-side. Subscribing to unauthorized custom topics causes the broker to close the connection. Custom topics require backend configuration before they can be used.
  2. Check whether the same node ID has been flashed onto multiple devices that are both online at the same time. RainMaker allows only one device per node ID concurrently — the cloud disconnects the earlier device when a second one connects, causing repeated connect/disconnect cycles.

On this page